package au.com.iglootech.TaxTimeToolTip.ui.company;

import au.com.iglootech.TaxTimeToolTip.Entity.Company;
import au.com.iglootech.TaxTimeToolTip.ui.feerate.ShowFeeRateTab;

import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;

public class ManageCompanyPage extends CustomComponent {
	VerticalLayout mainLayout = new VerticalLayout();


	public ManageCompanyPage() {

		initContent();
	}

	private void initContent() {
		Panel panel = new Panel();
		TabSheet ts = new TabSheet();
		ts.setSizeFull();
		ts.addStyleName("bar");
		ts.addComponent(new CreateCompanyTab());
		ts.addComponent(new ManageCompanyTab());
		ts.addListener(new TabSheet.SelectedTabChangeListener() {
			
			@Override
			public void selectedTabChange(SelectedTabChangeEvent event) {
				if(event.getTabSheet().getSelectedTab() instanceof ManageCompanyTab)
				{
					((ManageCompanyTab)event.getTabSheet().getSelectedTab()).refresh();
				}
			}
		});
		panel.addComponent(ts);
		mainLayout.addComponent(panel);
		this.setCompositionRoot(mainLayout);
	}
}
